﻿@model IEnumerable<SchoolManagerMVC.Web.Areas.Courses.ViewModels.StudentInCourseViewModel>

@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>Students enrolled in: @Model.First().Course</h2>
<table>
    <tr>        
        <th>
            Student
        </th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    if (item.Student.IsEmpty())
    {
        continue;
    }
    <tr>
        <td>
            @Html.RouteLink(item.Student, "Student_details", new { id = item.UniqueID }, null) 
        </td>
        <td>
            @{Html.RenderPartial("StudentInCoursePartial", item);}
        </td>
    </tr>
}

</table>
<p>
    @Html.ActionLink("Add Single Student", "Create", new { id = Model.First().CourseId },null)
</p>